<body>
<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-card-header">{$page_name}</div>
				<div class="layui-card-body" pad15>
<form action="{:url(request()->action())}" method="post">
					<div class="layui-form">
						<div class="layui-form-item">
							<label class="layui-form-label">角色名称</label>
							<div class="layui-input-inline">
								<input type="text" class="layui-input" name="name" value="{$info.name}" lay-verify="required" placeholder="请输入角色名称">
							</div>
							<div class="layui-form-mid layui-word-aux">请输入角色名称</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">启用状态</label>
							<div class="layui-input-block">
								<input type="radio" name="status" value="1" title="启用" {if $info.status == 1} checked {/if}>
								<input type="radio" name="status" value="0" title="禁用" {if $info.status == 0} checked {/if}>
							</div>
						</div>
						<div class="layui-form-item layui-form-text">
							<label class="layui-form-label">角色备注</label>
							<div class="layui-input-block" style="max-width: 400px;">
								<textarea name="info" class="layui-textarea" placeholder="请输入备注内容">{$info.info}</textarea>
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<input name="id" type="hidden" value="{$info.id}">
								<button class="layui-btn" 
									lay-submit 
									lay-filter="wy-submit"
									wy-changetabid="adminrole_index"
									wy-closetabid="adminrole_info"
									wy-reloadtable="wy_table_lists"
								>确认提交</button>
								<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
							</div>
						</div>
					</div>
</form>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
layui.use(['form'], function(){
	var $ = layui.jquery,form = layui.form;
	show_cat_info(0);
	form.on('select(cat_id)',function(data){
		show_cat_info(data.value);
	});
	function show_cat_info(value){
		var info = '';
		if(value == 0){
			info = $("select[lay-filter='cat_id']").find("option:selected").attr("data-content");
		}else{
			info = $("select[lay-filter='cat_id']").find("option[value='"+value+"']").attr("data-content");
		}
		info += "；只允许上传 jpg|png|gif|bmp|jpeg 格式的图片地址";
		$("#show_cat_info").html(info);
	}
});

</script>
</body>